// LogRecordViewModel.java
package no.nordicsemi.android.nrfmesh.viewmodels;

import android.app.Application;
import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import no.nordicsemi.android.nrfmesh.database.AppDatabase;
import no.nordicsemi.android.nrfmesh.database.entity.LogRecord;

public class LogRecordViewModel extends AndroidViewModel {
    private final AppDatabase database;
    private final ExecutorService executorService;
    private final LiveData<List<LogRecord>> logRecords;

    public LogRecordViewModel(@NonNull Application application) {
        super(application);
        database = AppDatabase.getInstance(application);
        executorService = Executors.newFixedThreadPool(2);
        logRecords = database.logRecordDao().getAllLogRecords();
    }

    public LiveData<List<LogRecord>> getLogRecords() {
        return logRecords;
    }
}
